function double(value, success, failure) {
  setTimeout(() => {
    try {
      if (typeof value !== "number") {
        throw "Must provider number as first argument";
      }
      success(2 * value);
    } catch (e) {
      failure(e);
    }
  }, 1000);
}

const successCallback = x => {
  double(x, y => console.log(`Success:${y}`));
};
const failureCallback = e => console.log(`Failure:${e}`);

double(3, successCallback, failureCallback);
double("b", successCallback, failureCallback);
